//监听陀螺仪
window.addEventListener('deviceorientation', function (event) {
    var alpha = event.alpha; //左右
    var beta = event.beta; //上下
    var gamma = event.gamma; //翻转

    document.querySelector(".z1").style.transform = "translate3d(" + gamma / 5 + "px," + beta + "px,0)";
    document.querySelector(".z2").style.transform = "translate3d(" + -gamma / 5 + "px," + -beta / 5 +
        "px,0)";
    document.querySelector(".z3").style.transform = "translate3d(" + gamma / 2 + "px,," + beta / 2 +
        "px,0)";
    document.querySelector(".z4").style.transform = "translate3d(0," + beta / 5 + "px,0)";
    document.querySelector(".z5").style.transform = "translate3d(0," + -beta / 5 + "px,0)";

    document.querySelector(".t1").style.transform = "translate3d(0," + beta / 5 + "px,0)";
    document.querySelector(".t2").style.transform = "translate3d(" + -gamma / 5 + "px," + -beta / 5 +
        "px,0)";
    document.querySelector(".t3").style.transform = "translate3d(" + gamma / 5 + "px," + beta / 5 +
        "px,0)";

    document.querySelector("#c1").style.transform = "translate3d(" + -gamma / 3 + "px," + -beta / 3 +
        "px,0)";

}, false);